.class public final Lcom/wqmobile/sdk/protocol/b/c;
.super Ljava/lang/Object;

# interfaces
.implements Lcom/wqmobile/sdk/protocol/b/a;


# static fields
.field private static a:Lcom/wqmobile/sdk/protocol/b/c;


# instance fields
.field private b:Ljava/net/DatagramSocket;

.field private c:Ljava/net/InetAddress;

.field private d:I


# direct methods
.method private constructor <init>(Ljava/net/InetAddress;I)V
    .locals 1

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object p1, p0, Lcom/wqmobile/sdk/protocol/b/c;->c:Ljava/net/InetAddress;

    iput p2, p0, Lcom/wqmobile/sdk/protocol/b/c;->d:I

    new-instance v0, Ljava/net/DatagramSocket;

    invoke-direct {v0}, Ljava/net/DatagramSocket;-><init>()V

    iput-object v0, p0, Lcom/wqmobile/sdk/protocol/b/c;->b:Ljava/net/DatagramSocket;

    return-void
.end method

.method public static a(Ljava/net/InetAddress;I)Lcom/wqmobile/sdk/protocol/b/a;
    .locals 1

    sget-object v0, Lcom/wqmobile/sdk/protocol/b/c;->a:Lcom/wqmobile/sdk/protocol/b/c;

    if-nez v0, :cond_0

    new-instance v0, Lcom/wqmobile/sdk/protocol/b/c;

    invoke-direct {v0, p0, p1}, Lcom/wqmobile/sdk/protocol/b/c;-><init>(Ljava/net/InetAddress;I)V

    sput-object v0, Lcom/wqmobile/sdk/protocol/b/c;->a:Lcom/wqmobile/sdk/protocol/b/c;

    :goto_0
    sget-object v0, Lcom/wqmobile/sdk/protocol/b/c;->a:Lcom/wqmobile/sdk/protocol/b/c;

    return-object v0

    :cond_0
    sget-object v0, Lcom/wqmobile/sdk/protocol/b/c;->a:Lcom/wqmobile/sdk/protocol/b/c;

    iput-object p0, v0, Lcom/wqmobile/sdk/protocol/b/c;->c:Ljava/net/InetAddress;

    iput p1, v0, Lcom/wqmobile/sdk/protocol/b/c;->d:I

    goto :goto_0
.end method


# virtual methods
.method public final a([B)V
    .locals 4

    iget-object v0, p0, Lcom/wqmobile/sdk/protocol/b/c;->b:Ljava/net/DatagramSocket;

    if-eqz v0, :cond_0

    new-instance v0, Ljava/net/DatagramPacket;

    array-length v1, p1

    iget-object v2, p0, Lcom/wqmobile/sdk/protocol/b/c;->c:Ljava/net/InetAddress;

    iget v3, p0, Lcom/wqmobile/sdk/protocol/b/c;->d:I

    invoke-direct {v0, p1, v1, v2, v3}, Ljava/net/DatagramPacket;-><init>([BILjava/net/InetAddress;I)V

    iget-object v1, p0, Lcom/wqmobile/sdk/protocol/b/c;->b:Ljava/net/DatagramSocket;

    invoke-virtual {v1, v0}, Ljava/net/DatagramSocket;->send(Ljava/net/DatagramPacket;)V

    return-void

    :cond_0
    new-instance v0, Ljava/lang/NullPointerException;

    const-string v1, "Null socket."

    invoke-direct {v0, v1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method public final b([B)V
    .locals 2

    array-length v0, p1

    if-gtz v0, :cond_0

    :goto_0
    return-void

    :cond_0
    iget-object v1, p0, Lcom/wqmobile/sdk/protocol/b/c;->b:Ljava/net/DatagramSocket;

    if-eqz v1, :cond_1

    new-instance v1, Ljava/net/DatagramPacket;

    invoke-direct {v1, p1, v0}, Ljava/net/DatagramPacket;-><init>([BI)V

    iget-object v0, p0, Lcom/wqmobile/sdk/protocol/b/c;->b:Ljava/net/DatagramSocket;

    invoke-virtual {v0, v1}, Ljava/net/DatagramSocket;->receive(Ljava/net/DatagramPacket;)V

    goto :goto_0

    :cond_1
    new-instance v0, Ljava/lang/NullPointerException;

    const-string v1, "Null socket."

    invoke-direct {v0, v1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method protected final finalize()V
    .locals 1

    iget-object v0, p0, Lcom/wqmobile/sdk/protocol/b/c;->b:Ljava/net/DatagramSocket;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/wqmobile/sdk/protocol/b/c;->b:Ljava/net/DatagramSocket;

    invoke-virtual {v0}, Ljava/net/DatagramSocket;->close()V

    :cond_0
    return-void
.end method
